﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace SMS.Magus
{
    public partial class frmInputNo : DevExpress.XtraEditors.XtraForm
    {
        public XtraUserControl ParentControl { get; set; }
        public frmInputNo()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (txtPre7.Text.Length < 7)
            {
                //请输入7位数字
                DevExpress.XtraEditors.XtraMessageBox.Show("数字不能小于7位！", "提示", MessageBoxButtons.OK);
                this.txtPre7.Focus();
                return;
            }
            else
            {
                frmAutoTel autel = (frmAutoTel)this.ParentControl;
             

                ListViewItem[] items = new ListViewItem[10000];
                ListViewItem item;
                for (int i = 0; i < 10000; i++)
                {
                    item = new ListViewItem(txtPre7.Text + getstrbyint(i, 4));
                    items[i] = item;
                    //  col.Add(tb[i].PhoneNum);
                    //   lsvSendList.Items.Add(tb[i].PhoneNum);
                }

                autel.lvSourceNo.Items.AddRange(items);
                this.Close();
            }
        }
        private string getstrbyint(int i, int len)
        {
            string str;
            str = i.ToString();
            if (str.Equals(""))
            {
                str = "0";
            }
            if (str.Length > len)
            {
                str = "0";
            }
            while (str.Length < len)
            {
                str = "0" + str;
            }
            return str;
        }
        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
